CheckLoginSDK [C#]

[C#]

//Get encryption key private byte[] GetHashKey(string hashKey) { // Initialise UTF8Encoding encoder = new UTF8Encoding(); // Get the salt string salt = "fCycS3qSKsUlNz7wCb39XckN"; byte[] saltBytes = encoder.GetBytes(salt); // Setup the hasher Rfc2898DeriveBytes rfc = new Rfc2898DeriveBytes(hashKey, saltBytes); // Return the key return rfc.GetBytes(16); }

 

[C#]

//Encrypt data by AES private string Encrypt(byte[] key, string dataToEncrypt) { // Initialise AesManaged encryptor = new AesManaged(); // Set the key encryptor.Key = key; encryptor.IV = key; // create a memory stream using (MemoryStream encryptionStream = new MemoryStream()) { // Create the crypto stream using (CryptoStream encrypt = new CryptoStream(encryptionStream, encryptor.CreateEncryptor(), CryptoStreamMode.Write)) { // Encrypt byte[] utfD1 = UTF8Encoding.UTF8.GetBytes(dataToEncrypt); encrypt.Write(utfD1, 0, utfD1.Length); encrypt.FlushFinalBlock(); encrypt.Close(); // Return the encrypted data return Convert.ToBase64String(encryptionStream.ToArray()); } } }

 

[C#]

//Connect to the QL system and check credential from the SDK public ErrorType CheckLoginSDK(out string sessionId, out View_Manager manager, out long serverDate, string login, string password) { //Encrypt the password string passswordEncrypt = GetPasswordEncrypt(password, GlobalParam.SERVER_KEY); //<param name=sessionId>Session Id retrieved at the user's connection</param> //<param name=manager>Manager to retrive</param> //<param name=serverDate>Date of the server</param> //<param name=login>Manager login</param> //<param name=password>Manager password</param> //<returns>ErrorType indicates the status of the transaction</returns> return client.CheckLoginSDK(out sessionId, out manager, out serverDate, login, passswordEncrypt); }